$progress-height: 32px;
$proccess-border-height: 32px;
$progress-state-common-bg-color: #F2F2F2;
$progress-state-before-bg-color: $color-primary-light-1;

@mixin triangle-color($backgroundColor: '', $borderColor: 'none') {
  & {
    border: 1px solid $backgroundColor;
  }
  .biz-process-left-triangle {
    &:before {
      background-color: $backgroundColor;
    }
    &:after {
      background-color: $backgroundColor;
    }
  }
  .biz-process-right-triangle {
    &:before {
      border-right: 1px solid $borderColor;
      border-top: 1px solid $borderColor;
      background-color: $backgroundColor;
    }
  }
}

@mixin process-state-border-color($color) {
  & {
    &:before,
    &:after {
      background-color: $color;
    }
    .biz-process-right-triangle {
      &:before {
        background-color: $color;
      }
    }
  }
}

@mixin triangle-selected {
  & {
    border-left: none !important;
  }
  .biz-process-left-triangle-top {
    background: $color-primary;
    
    display: block;
    width: 28px;
    height: 1px;
    transform: rotate(67deg);
    
    position: absolute;
    top: 4px;
    left: -19px;
  }
  .biz-process-left-triangle-bottom {
    background: $color-primary;

    display: block;
    width: 18px;
    height: 1px;
    transform: rotate(293deg);

    position: absolute;
    bottom: -25px;
    left: -12px;
    z-index: 1;
  }
}

/* 流程信息 */
.biz-process {
  display: flex;

  align-items: center;
  overflow:hidden;
  &-state {
    background-color: $progress-state-common-bg-color;
    border: 1px solid $progress-state-common-bg-color;
    color: #999;
    cursor: pointer;
    
    height: $progress-height;
    width: 98px;
    margin:0 0 0 12px;

    line-height: $progress-height;
    text-align: center;

    position: relative;

    &:hover {
      border-left: none;
    }

    &-current {
      background-color: $color-primary;
      color: #fff;
    }

    &-before {
      background-color: $progress-state-before-bg-color;
      color: $color-success;
    }

    &-first {
      border-top-left-radius: ($progress-height * 0.1);
      border-bottom-left-radius: ($progress-height * 0.1);

      &:hover {
        border-left: 1px;
      }
    }

    &-last {
      border-top-right-radius: ($progress-height * 0.1);
      border-bottom-right-radius: ($progress-height * 0.1);
      border-right: 0;
    }
  }
}

/* 流程信息第一个 */
.biz-process-state-first {
  margin: 0;
  .biz-process-left-triangle {
    display: none;
  }
  &:hover {
    background-color: #fff;
    border: 1px solid $color-primary;
    color: $color-primary;
    & {
      &:before,
      &:after {
        width: 80px;
      }
    }
  }

}

/* 流程信息最后一个 */
.biz-process-state-last {
  .biz-process-right-triangle {
    display: none;
  }
}

/* 流程信息状态 */
.biz-process-state {
  color: $color-primary-light-6;
  &:hover {
    background-color: $color-primary;
    color: #fff;
  }

  &:before {
    content: '';

    position: absolute;
    top: -1px;
    right: -2px;
    z-index: 1;

    height: 1px;
    width: 106px;
  }

  &:after {
    content: '';

    position: absolute;
    bottom: -1px;
    right: -3px;
    z-index: 1;

    height: 1px;
    width: 105px;
  }
  
}

/* 流程信息 当前的 */
.biz-process-state-current {
  color:white;
  @include triangle-color($color-primary, $color-primary);
}

/* 流程信息 之前的 */
.biz-process-state-before {
  @include triangle-color($progress-state-before-bg-color, $progress-state-before-bg-color);
  &:hover {
    @include process-state-border-color($color-primary);
    @include triangle-color($color-primary, $color-primary);
  }
}

/* 流程信息 之后的 */
.biz-process-state-after {
  cursor: not-allowed;;
  color:#999;
  &:hover {
    background-color: $progress-state-common-bg-color;
    color: $text-color-primary;
  }

}

.biz-process-state-current.biz-process-state-last {
  &:hover {
    border: 1px solid $color-primary;
    background-color: #fff;
    color: $color-primary;
    @include triangle-color(#fff, $color-primary);
    @include process-state-border-color($color-primary);
    @include triangle-selected();
  }

  &:before {
    left: -7px !important;
    top: -1px !important;
    width: 60px !important;
  }

  &:after {
    left: -6px !important;
    bottom: -1px !important;
    width: 60px !important;
  }
}

.biz-process-state-first,
.biz-process-state-last {
  border: 1px solid $progress-state-before-bg-color;
}

.biz-process-state-selected {
  background-color: #fff;
  border: 1px solid $color-primary;
  color: $color-primary;
  @include process-state-border-color($color-primary);
  @include triangle-color(#fff, $color-primary);
  
  &:hover {
    color: #fff;
  }
  
  &.biz-process-state-first,
  &.biz-process-state-lst {
    &:before,
    &:after {
      width: 80px;
    }
  }
  
  @include triangle-selected();
  
  &:hover{
    .biz-process-left-triangle {
      &:before {
        background-color: $color-primary;
      }
      &:after {
        background-color: $color-primary;
      }
    }
    .biz-process-right-triangle {
      &:before {
        background-color: $color-primary;
      }
    }
  }
}

.biz-process-state-before.biz-process-state-selected {
  border-left: none;
}

.biz-process-state-before.biz-process-state-selected.biz-process-state-first {
  border: 1px solid $color-primary !important;
}

/* 流程信息 三角形 */
.biz-process-left-triangle,
.biz-process-right-triangle {
  span {
    position: absolute;
  }
}

.biz-process-left-triangle {
  position: absolute;
  left: 0;
  top: 0;
  
  &:before { 
    background-color: $progress-state-common-bg-color;
    content: ' ';
    display: block;
    position: absolute;
    left: 3px;
    top: -2px;
    width: $progress-height + 11px;
    height: $progress-height + 13px;
    transform: rotateZ(250deg) skew(-38deg, -2deg);
  }
  
  &:after { 
    background-color: $progress-state-common-bg-color;
    content: ' ';
    display: block;
    position: absolute;
    left: 0px;
    top: 0;
    width: $progress-height + 8px;
    height: $progress-height + 8px;
    transform: rotateZ(210deg) skew(5deg, -11deg);
  }
}

.biz-process-right-triangle {
  position: absolute;
  right: 0;
  top: 0;
  
  &:before {
    background-color: $progress-state-common-bg-color;
    content: ' ';
    display: block;

    position: absolute;
    left: -20px;
    top: 0;

    width: $progress-height;
    height: $progress-height;
    transform: rotateZ(45deg) skew(22deg, 22deg);
  }
}

/* 流程信息 异常状态 */
.biz-process-exception {
  font-size: $font-size-small;
  height: 24px;
  line-height: 24px;
  // position: relative;
  display: flex;
  align-items: center;
  & > div {
    text-align: center;
    // position: absolute;
  }

}

.biz-process-exception-text {
  // width: 180px !important;
  color: #f0ad4e;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin:  0 15px;
}

.biz-process-exception-time {
  margin-left: 15px;
}

/* 已取消 */
.biz-process-offed {
  border-radius: 11px;
  border: 1px solid $progress-state-common-bg-color;
  color: #fff;

  height: 22px;
  width: 52px;

  text-align: center;
  font-size: $font-size-small;
  line-height: 22px;
}

/* 适配样式 */
.biz-process-state-after {
  &.biz-process-state-last {
    border: none;
  }
}

.biz-process-state-current {
  &.biz-process-state-first,
  &.biz-process-state-last {
    border: 1px solid $color-primary !important;
  }
  &.biz-process-state-last {
    .biz-process-left-triangle-bottom {
      :before {
        top: 9px !important;
      }
    }
  }
}

.biz-process-state-name {
  position: relative;
  z-index: 9;
}

.biz-process-intelligent {
  color: #FF7043;
  font-size: 12px;
  height: 32px;
  line-height: 32px;
}

.task-process-state {
  max-width: 300px;
  @include text-ellipsis();
}